package c.x.jy.dao.dao;

import c.x.jy.dao.dto.MemberEntityDto;
import c.x.jy.dao.dto.OrderEvaluateEntityDto;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import c.x.jy.dao.entity.MemberEntity;

/**
 * 会员信息表
 * 
 * @author amwhyh
 * @email xxx@xx.com
 * @date 2021-05-20 20:09:48
 */
@Mapper
public interface MemberDao extends BaseMapper<MemberEntity> {
    @Select("select * from t_member where id=${memberId} for update ")
	MemberEntity selectMemberByIdForUpdate(Long memberId);


    @Select("select m.*,b.`name` as businessName from t_member m LEFT JOIN t_business b on m.business_id=b.id ${ew.customSqlSegment}")
    IPage<MemberEntityDto> querypage(IPage<MemberEntityDto> page, @Param(Constants.WRAPPER) QueryWrapper<MemberEntityDto> query);

    @Select("select * from t_member where referral_code='${referralCode}'  ")
    MemberEntity selectByReferralCode(String referralCode);
}

